package code09_final和抽象类;

public class Test03_final用法 {

}

class Animal {
	public void show() {
		System.out.println("Animal.show()");
	}

	// 被final修饰的方法，不允许子类重写
	public final void print() {
		System.out.println("Animal.print()");
	}
}

// 被final修饰的类，不允许被继承
final class Cat extends Animal {
	@Override
	public void show() {
		System.out.println("Cat.show()");
	}

	public void write(final int num) {
		// num = 5;
		System.out.println(num);
	}

}
